 const { override, fixBabelImports, addLessLoader, addWebpackAlias,addDecoratorsLegacy} = require('customize-cra');
  const path = require('path');
  const addCustomize = () => config => {
    require('react-app-rewire-postcss')(config, {
          plugins: loader => [
              require('postcss-flexbugs-fixes'),
              require('postcss-preset-env')({
                  autoprefixer: {
                      flexbox: 'no-2009',
                  },
                  stage: 3,
              }),
              require('postcss-aspect-ratio-mini')({}),
              require('postcss-px-to-viewport')({
                  viewportWidth: 750, // (Number) The width of the viewport.
                  viewportHeight: 1334, // (Number) The height of the viewport.
                  unitPrecision: 3, // (Number) The decimal numbers to allow the REM units to grow to.
                  viewportUnit: 'vw', // (String) Expected units.
                  selectorBlackList: ['.ignore', '.hairlines'], // (Array) The selectors to ignore and leave as px.
                  minPixelValue: 1, // (Number) Set the minimum pixel value to replace.
                  mediaQuery: false,// (Boolean) Allow px to be converted in media queries.
				  exclude: /(\/|\\)(node_modules)(\/|\\)/
              }),
              require('postcss-write-svg')({
                  utf8: false
              }),
              require('postcss-viewport-units')({
				  filterRule: rule => rule.selector.includes('::after') && rule.selector.includes('::before') && rule.selector.includes(':after') && rule.selector.includes(':before')
			  }),
              require('cssnano')({
                  preset: "advanced",
                  autoprefixer: false,
                  "postcss-zindex": false
              })
          ]
      });
    return config;
  }
  
     // function resolve(dir) {
     //     return path.join(__dirname, '.', dir)
     // }
module.exports = override(
  fixBabelImports('import', {
	 libraryName: 'antd-mobile',
	 style: 'css',
  }),
   addWebpackAlias({
      "@": path.resolve(__dirname, 'src')
    }),
  addDecoratorsLegacy(),//使用装饰器
  addCustomize()
);

